/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package b_and_b_properties.data;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 *
 * @author Omea
 */
@Entity
@Table(name = "Appliances", catalog = "sapcapstone", schema = "")
@NamedQueries({
    @NamedQuery(name = "Appliances.findAll", query = "SELECT a FROM Appliances a"),
    @NamedQuery(name = "Appliances.findByIdAppliances", query = "SELECT a FROM Appliances a WHERE a.idAppliances = :idAppliances"),
    @NamedQuery(name = "Appliances.findByPropertyidProperty", query = "SELECT a FROM Appliances a WHERE a.propertyidProperty = :propertyidProperty"),
    @NamedQuery(name = "Appliances.findByUnitidUnit", query = "SELECT a FROM Appliances a WHERE a.unitidUnit = :unitidUnit"),
    @NamedQuery(name = "Appliances.findByName", query = "SELECT a FROM Appliances a WHERE a.name = :name"),
    @NamedQuery(name = "Appliances.findBySerialNumber", query = "SELECT a FROM Appliances a WHERE a.serialNumber = :serialNumber"),
    @NamedQuery(name = "Appliances.findByPurchaseDate", query = "SELECT a FROM Appliances a WHERE a.purchaseDate = :purchaseDate"),
    @NamedQuery(name = "Appliances.findByWarrantyLength", query = "SELECT a FROM Appliances a WHERE a.warrantyLength = :warrantyLength"),
    @NamedQuery(name = "Appliances.findByComments", query = "SELECT a FROM Appliances a WHERE a.comments = :comments")})
public class Appliances implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idAppliances")
    private Integer idAppliances;
    @Column(name = "Property_idProperty")
    private Integer propertyidProperty;
    @Column(name = "Unit_idUnit")
    private Integer unitidUnit;
    @Column(name = "Name")
    private String name;
    @Column(name = "SerialNumber")
    private String serialNumber;
    @Column(name = "PurchaseDate")
    @Temporal(TemporalType.DATE)
    private Date purchaseDate;
    @Column(name = "WarrantyLength")
    private Integer warrantyLength;
    @Column(name = "Comments")
    private String comments;

    public Appliances() {
    }

    public Appliances(Integer idAppliances) {
        this.idAppliances = idAppliances;
    }

    public Integer getIdAppliances() {
        return idAppliances;
    }

    public void setIdAppliances(Integer idAppliances) {
        Integer oldIdAppliances = this.idAppliances;
        this.idAppliances = idAppliances;
        changeSupport.firePropertyChange("idAppliances", oldIdAppliances, idAppliances);
    }

    public Integer getPropertyidProperty() {
        return propertyidProperty;
    }

    public void setPropertyidProperty(Integer propertyidProperty) {
        Integer oldPropertyidProperty = this.propertyidProperty;
        this.propertyidProperty = propertyidProperty;
        changeSupport.firePropertyChange("propertyidProperty", oldPropertyidProperty, propertyidProperty);
    }

    public Integer getUnitidUnit() {
        return unitidUnit;
    }

    public void setUnitidUnit(Integer unitidUnit) {
        Integer oldUnitidUnit = this.unitidUnit;
        this.unitidUnit = unitidUnit;
        changeSupport.firePropertyChange("unitidUnit", oldUnitidUnit, unitidUnit);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        String oldName = this.name;
        this.name = name;
        changeSupport.firePropertyChange("name", oldName, name);
    }

    public String getSerialNumber() {
        return serialNumber;
    }

    public void setSerialNumber(String serialNumber) {
        String oldSerialNumber = this.serialNumber;
        this.serialNumber = serialNumber;
        changeSupport.firePropertyChange("serialNumber", oldSerialNumber, serialNumber);
    }

    public Date getPurchaseDate() {
        return purchaseDate;
    }

    public void setPurchaseDate(Date purchaseDate) {
        Date oldPurchaseDate = this.purchaseDate;
        this.purchaseDate = purchaseDate;
        changeSupport.firePropertyChange("purchaseDate", oldPurchaseDate, purchaseDate);
    }

    public Integer getWarrantyLength() {
        return warrantyLength;
    }

    public void setWarrantyLength(Integer warrantyLength) {
        Integer oldWarrantyLength = this.warrantyLength;
        this.warrantyLength = warrantyLength;
        changeSupport.firePropertyChange("warrantyLength", oldWarrantyLength, warrantyLength);
    }

    public String getComments() {
        return comments;
    }

    public void setComments(String comments) {
        String oldComments = this.comments;
        this.comments = comments;
        changeSupport.firePropertyChange("comments", oldComments, comments);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAppliances != null ? idAppliances.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Appliances)) {
            return false;
        }
        Appliances other = (Appliances) object;
        if ((this.idAppliances == null && other.idAppliances != null) || (this.idAppliances != null && !this.idAppliances.equals(other.idAppliances))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "appliances.Appliances[ idAppliances=" + idAppliances + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
